#include<iostream>
#include<algorithm>

using namespace std;
typedef long long ll;
const ll mod = 1e9 + 7;

ll quick_pow(ll a, ll b) {
    if (b < 0)
        return 0;
    ll ans = 1 % mod;
    for (; b; b >>= 1) {
        if (b & 1) ans = ans * a % mod;
        a = a * a % mod;
    }
    return ans;
}

ll n;
ll arr[1000005] = {0};

int main() {

    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> arr[i];
        arr[i] %= mod;
    }
    sort(arr, arr + n);
    ll k = quick_pow(2, n - 1);
    ll d = quick_pow(2, n - 2);
    ll sum = 0;
    for (int i = n - 1; i >= 0; i--) {
        sum += (k * arr[i]) % mod;
        sum %= mod;
        k += d;
        k %= mod;
    }
    ll t = quick_pow(2, n);
    cout << (t * sum) % mod << endl;
    return 0;
}